//
//  TTMusicDiscoveryPageThirdCollectionViewCell.m
//  TTMusic
//
//  Created by chenpengyu on 16/3/31.
//  Copyright © 2016年 cpy. All rights reserved.
//

#import "TTMusicDiscoveryPageThirdCollectionViewCell.h"

@implementation TTMusicDiscoveryPageThirdCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.numberLabel = [[TTMusicBaseLabel alloc] initWithFrame:CGRectMake(0, 0, 45, 80)];
        _numberLabel.textAlignment = NSTextAlignmentCenter;
        [self updateFrame:self.numberLabel];
        
        self.picImageView = [[UIImageView alloc] initWithFrame:CGRectMake(45, 10, 60, 60)];

        [self updateFrame:self.picImageView];
        self.titleLabel = [[TTMusicBaseLabel alloc] initWithFrame:CGRectMake(128, 14, 190, 25)];
        [self updateFrame:self.titleLabel];
        self.singerLabel = [[TTMusicBaseLabel alloc] initWithFrame:CGRectMake(128, 46, 222, 21)];
        [self updateFrame:self.singerLabel];
        self.collectLabel = [[TTMusicBaseLabel alloc] initWithFrame:CGRectMake(240, 46, 222, 21)];
        [self updateFrame:self.collectLabel];
        self.qualityLabel = [[TTMusicBaseLabel alloc] initWithFrame:CGRectMake(285, 18, 35, 18)];
        [self updateFrame:self.qualityLabel];
        self.playImageView = [[UIImageView alloc] initWithFrame:CGRectMake(372, 24, 31, 31)];
        self.playImageView.image = [UIImage imageNamed:@"play"];
        [self updateFrame:self.playImageView];
        [self.contentView addSubview:_numberLabel];
        [self.contentView addSubview:_picImageView];
        [self.contentView addSubview:_titleLabel];
        [self.contentView addSubview:_singerLabel];
        [self.contentView addSubview:_collectLabel];
        [self.contentView addSubview:_qualityLabel];
        [self.contentView addSubview:_mvButton];
        [self.contentView addSubview:_playImageView];
    }
    return self;
}
- (void)updateFrame:(UIView *)view{
    
    CGRect rect = view.frame;
    view.frame = CGRectMake(rect.origin.x * FitWidth, rect.origin.y * FitWidth, rect.size.width * FitWidth, rect.size.height * FitWidth);
}
- (void)setDataModel:(CPYDiscoveryPageDataModel *)dataModel {
    _dataModel = dataModel;
}
- (void)setSongListModel:(CPYDiscoveryPageSongListModel *)songListModel {
    _songListModel = songListModel;
    [_picImageView sd_setImageWithURL:[NSURL URLWithString:songListModel.picUrl]];
    _titleLabel.text = songListModel.name;
    _singerLabel.text = [NSString stringWithFormat:@"%@❤️%@", songListModel.singerName, songListModel.favorites.stringValue];
//    _collectLabel.text = [NSString stringWithFormat:@"❤️%@", songListModel.favorites.stringValue];
    _collectLabel.font = [UIFont systemFontOfSize:15];
    _singerLabel.font = [UIFont systemFontOfSize:15];
}
- (void)setNum:(NSInteger)num {
    _num = num;
    _numberLabel.text=[NSString stringWithFormat:@"%ld",_num];

}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
